﻿


<div id="no-credit-box">

<div id="payment_update" class="box-shadow padding10">
        
<div id="dlgLogin">

    <h4 class="serif-it">Insufficient Credit!</h4>

    <p>Sorry, you do not have enough credits to pitch.</p>

    <div style="width: 450px; margin: 0 auto;">  

@using (Html.BeginForm("CreditBuy", "Want", FormMethod.Post)) {
     
            <p class="green-button padding010" style="display: inline; float: left;">
             
                <select name="howManyCredits">
                    <option value="0" >Select Credit Amount</option>
                    <option value="10" >10 Credits</option>
                    <option value="20" >20 Credits</option>
                </select>
    
            <input type="submit" value="Purchase credits" id="btnSubmit" />

            </p>

            <a href="#" id="closeOverlay" class="button-m red-button fRight">Pitch later</a>
   
 }

     </div>
 
 <div class="clear"></div>

</div>

    </div>

</div>

  <script type="text/javascript">
      $(document).ready(function () {
          $("#btnSubmit").click(function () {
              var http = new XMLHttpRequest();
              var url = "/Want/CreditBuy";
              var params = "selval=" + $('select[name=howManyCredits]').val();
              http.open("POST", url, true);
              http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
              http.onreadystatechange = function () {//Call a function when the state changes.
                  if (http.readyState == 4 && http.status == 200) {
                      $("#auth_modal_container").dialog('close');
                      $("#auth_modal_container").css("display", "none");
                      bal = 1;
                  }
              }
              alert("sending : " + params);
              http.send(params);

          });
      });
           </script>
<script type="text/javascript">

 


  /*
        $("#btnSubmit").click(function () {
            var http = new XMLHttpRequest();
            var url = "/Want/CreditBuy";
            var params = "selval=" + $('select[name=howManyCredits]').val();
            //alert('purchasing ' + params + ' credits');
            http.open("POST", url, true);
            http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
            http.onreadystatechange = function () { //Call a function when the state changes.
                if (http.readyState == 4 && http.status == 200) {
                    //  $("#auth_modal_container").dialog('close');
                    // $("#auth_modal_container").css("display", "none");
                    alert('he made it close');
                    bal = 1;
                }
            }
            alert('sending:' + params);
            http.send(params);

        });
*/

        $("#closeOverlay").click(function () {
            $("#creditBox").remove();
        });


   

</script>